UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xoWKmT7l4y5UVVl1mSfaDC0PFYUzSiWEkMXcmeeFrzc=' 
WHERE 
  key_id = '68aebbb8bb38036df0c063930b61aa85249519d0b88da6ca3b8a8e69a0dfaab8' 
  AND (
    token = 'xoWKmT7l4y5UVVl1mSfaDC0PFYUzSiWEkMXcmeeFrzc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025