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

Query time 0.00024