UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uMV9wx8E1UJcShHrI3bI54SQ7x0qTw3zUfAhes2hT/4=' 
WHERE 
  key_id = '336c0135546cea793754bad4496f18e3196efa70eb465373eb246ed523f654c1' 
  AND (
    token = 'uMV9wx8E1UJcShHrI3bI54SQ7x0qTw3zUfAhes2hT/4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030