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

Query time 0.00058