UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fzdKa6L+cOB66r2Qui/mJ9Tby3Bfs+dC1ChQF2cNRQY=' 
WHERE 
  key_id = 'd934793ecb2fd3e5ad58393f14f571c19c31b61817fe5ca97064a3b8acfe9d4c' 
  AND (
    token = 'fzdKa6L+cOB66r2Qui/mJ9Tby3Bfs+dC1ChQF2cNRQY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028