UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cWQgysupA436uDd7ILqDo/Te36NQ5guAmuV1PYTFJVE=' 
WHERE 
  key_id = 'bda02c86f3cf649f78bcdfcc88a69331812fe3a8731e4233d42546a9e6408df8' 
  AND (
    token = 'cWQgysupA436uDd7ILqDo/Te36NQ5guAmuV1PYTFJVE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055