UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z7UmfU+3oLeVngPgHM+js9of3o/QUVn+n57t9lT6RXo=' 
WHERE 
  key_id = '8523ad17f09b96569c819ac2048d15165fe3c127c7a4a7369cca07c2eced3350' 
  AND (
    token = 'Z7UmfU+3oLeVngPgHM+js9of3o/QUVn+n57t9lT6RXo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023