UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dkCi3XujQF6bRL29ByBJbpYfQewdo6ULO5yQLx+v62s=' 
WHERE 
  key_id = 'a3923954f38bd1f962be57b757ceee650a52aac4ce1efba5a2a3304f8d755543' 
  AND (
    token = 'dkCi3XujQF6bRL29ByBJbpYfQewdo6ULO5yQLx+v62s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027