UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gWkkuKdyyDQS71AcliDXcVVwSxrDoMQ36G09SffScxE=' 
WHERE 
  key_id = '59f24437edbf49279646d94ec1200d8f4358ec73de96a5305f112e649a8f2b62' 
  AND (
    token = 'gWkkuKdyyDQS71AcliDXcVVwSxrDoMQ36G09SffScxE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025