UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ajIjysIlklwMM7o+b3+0YVSmky7n3dYybRA6wMANAMc=' 
WHERE 
  key_id = '29b2c2b3c9d739efae95d97e34d1c4faa0d2c225d6b1aef0486159431ea5d06b' 
  AND (
    token = 'ajIjysIlklwMM7o+b3+0YVSmky7n3dYybRA6wMANAMc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039