UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tTZ7zTUdU8sxwPwB2FiR8q0icvuAn2X13Ylyw8M9qJE=' 
WHERE 
  key_id = '878807865d0755171a044d04e501ea68ffeac3d96701693c2488c2bb852b61f3' 
  AND (
    token = 'tTZ7zTUdU8sxwPwB2FiR8q0icvuAn2X13Ylyw8M9qJE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045