UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PfgE8k6NfExh+dmahAKwLNHK+k2HumRtXW5dnAo05/s=' 
WHERE 
  key_id = '432999bf365328aab79b6b42b0bab10fa449b229ba56bf29de799250e5fcdb5f' 
  AND (
    token = 'PfgE8k6NfExh+dmahAKwLNHK+k2HumRtXW5dnAo05/s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021