UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KvVHsjd8ghBzupFbpSxpn3KTVmclqsFK83W9lqS8FDI=' 
WHERE 
  key_id = '032caf0b30a29d0d1db558940fd0818e5524de54ac1a80bff9cb80883b243137' 
  AND (
    token = 'KvVHsjd8ghBzupFbpSxpn3KTVmclqsFK83W9lqS8FDI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017