UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sxK1UFamno0eTJSjMnsTZ7DUylqkSPmTiNF3dckRoxM=' 
WHERE 
  key_id = '086fed0d7ee57e789f7ce6013940a73e58079e32e694cb3c9ddecf84dab44406' 
  AND (
    token = 'sxK1UFamno0eTJSjMnsTZ7DUylqkSPmTiNF3dckRoxM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029