UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BhNI7BrLKvhd5PxQ44cXM+exyQY/5pz9Tsk3aI3goaE=' 
WHERE 
  key_id = '361acc90dde8f0a3d4e462125c8f9f35b2d1b53514121aa90c414052e43b45cd' 
  AND (
    token = 'BhNI7BrLKvhd5PxQ44cXM+exyQY/5pz9Tsk3aI3goaE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037