UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LSqlmUfk4IKVHPinkSAhG8UkArRqNb6SJKI1y2HMM5c=' 
WHERE 
  key_id = '2a6e33574396b1d0a838059b33f82e6b8b0352116ad27d5162802e04ce7764a7' 
  AND (
    token = 'LSqlmUfk4IKVHPinkSAhG8UkArRqNb6SJKI1y2HMM5c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030