UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H2aG2hcFCWC8wzTXdTTaakgUS4PR7sZZp2XO/A2cqzk=' 
WHERE 
  key_id = 'a1e1325d419c3cb0c57870b1f7cdb06ff092e57c2bfbff5a572a3a4d0316a391' 
  AND (
    token = 'H2aG2hcFCWC8wzTXdTTaakgUS4PR7sZZp2XO/A2cqzk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032