UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AGOCCsPFvTNVjN1mTCrADWA+oRqrH1YuSs5VoBrUlXo=' 
WHERE 
  key_id = '8fd665c9c42bf5bf251beebe450364f37c9bed1beea27ceb28c833ca8ac8b262' 
  AND (
    token = 'AGOCCsPFvTNVjN1mTCrADWA+oRqrH1YuSs5VoBrUlXo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021