UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xOK4cChyP6f+/smJnORDgWfAmXQaEMpJvg7Sk6/Q9E0=' 
WHERE 
  key_id = '342132d6e3731fc3a040d315199bcb29f965bd57592cc28e525a5dd1b3d2d35a' 
  AND (
    token = 'xOK4cChyP6f+/smJnORDgWfAmXQaEMpJvg7Sk6/Q9E0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042