UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P19B01KTWJXTgqHV6pTN2pI4g0nX+6vAT507lBMSZoE=' 
WHERE 
  key_id = '19908e91e56814646871f6c923135aaff27331a562b234160aa80aae14d0b008' 
  AND (
    token = 'P19B01KTWJXTgqHV6pTN2pI4g0nX+6vAT507lBMSZoE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028