UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S20+OM3ETtPe9IvvUNKbPpBpwndq8KpLAdaW3Iki47M=' 
WHERE 
  key_id = '95fddef16f6ec3724d472d7f3dfd47410ff73135e21c363cfd00e347a502db77' 
  AND (
    token = 'S20+OM3ETtPe9IvvUNKbPpBpwndq8KpLAdaW3Iki47M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032