UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd+nfRSzwd3zyibxcy8EC5C/JOaCZ1N7FKXV3onp80Tw=' 
WHERE 
  key_id = 'de4345c70c320ba12ced0540170a00893279bb2c2199f3136800adceebe1fe24' 
  AND (
    token = 'd+nfRSzwd3zyibxcy8EC5C/JOaCZ1N7FKXV3onp80Tw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044