UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GfkEvvQpsualwqrhcNx4B3ifYIDIl4oMC3zaQ4Ub1Eg=' 
WHERE 
  key_id = 'bd7eadca58529d4edf2b08a82d9a5900ec7c9d34a59457d3696cb5668c25f204' 
  AND (
    token = 'GfkEvvQpsualwqrhcNx4B3ifYIDIl4oMC3zaQ4Ub1Eg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046