UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K37DHpxaeDzZwRMdb4fPKduqR08M1XeTyK4LFlgCVCg=' 
WHERE 
  key_id = 'c25c2cd4c3e074bc7c779e515003ec5f069c351e977d9f4b7b3ab94ce086bfcb' 
  AND (
    token = 'K37DHpxaeDzZwRMdb4fPKduqR08M1XeTyK4LFlgCVCg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054