UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AFSp6oonPj7mHIPTdUgfRf2qTG8KsmZaT3M86nFLo7k=' 
WHERE 
  key_id = 'bf3c34e060999944d653ecbe448c35716434e2128351737b09e3a75f83ac44d7' 
  AND (
    token = 'AFSp6oonPj7mHIPTdUgfRf2qTG8KsmZaT3M86nFLo7k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034