UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DVbhtnNLGjr21CDr99daufM4xxEh0w+5ORnmlqA8L6E=' 
WHERE 
  key_id = '2f8675fa5aa818264a19543b0795aee17394b58a856fdcedb1f9a10caaf53447' 
  AND (
    token = 'DVbhtnNLGjr21CDr99daufM4xxEh0w+5ORnmlqA8L6E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021