UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O0l/n9vs0rdrS4XNJws+Hx7FtrLb425OrStVIDiYwGU=' 
WHERE 
  key_id = '23ccf7352bed235e5442af11c2ac5d3e17225f05043204dc06138dab5d344ede' 
  AND (
    token = 'O0l/n9vs0rdrS4XNJws+Hx7FtrLb425OrStVIDiYwGU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022