UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JgFcRZpKAhqC3zxDAbxjfwFVkBVSikTYl2HftPRg9BI=' 
WHERE 
  key_id = '7572f4589636eed11de226f090bad25ea88f3a236a42d40be8ea78f7e7aed51f' 
  AND (
    token = 'JgFcRZpKAhqC3zxDAbxjfwFVkBVSikTYl2HftPRg9BI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023